package com.example.g5project.chat.model.enumeration;

import java.util.Objects;
import java.util.stream.Stream;
import lombok.Getter;

@Getter
public enum IdentityEnum {

    ADMINISTRATOR(0, "管理员", "administrator_"),

    CUSTOMER(1, "访客", "customer_"),

    CONSULTANT(2, "咨询师", "consultant_"),

    SUPERVISOR(3, "督导", "supervisor_"),

    ;

    private Integer id;
    private String desc;
    private String prefix;


    IdentityEnum(int id, String desc, String prefix) {
        this.id = id;
        this.desc = desc;
        this.prefix = prefix;
    }

    public static IdentityEnum parseById(Integer id) {
        return Stream.of(IdentityEnum.values()).filter(e -> Objects.equals(e.getId(), id)).findAny()
            .orElseThrow(() -> new IllegalArgumentException("身份类型不正确"));
    }
}
